#!/usr/bin/python

import os, sys, shutil

def move_file(filepath, directory):	
	try:
		shutil.move(filepath, directory)
	except:
		print "Error: could not move file %s to directory %s" % (filepath, directory)
		sys.exit(1)

def copy_file(filepath, directory):
	try:
		shutil.copy(filepath, directory)
	except:
		print "Error: could not copy file %s to directory %s" % (filepath, directory)
		sys.exit(1)

def create_directory(directory):
	if not os.path.isdir(directory):
		try:
			os.mkdir(directory)
		except OSError, e:
			print "Error: " + e.strerror
			
	return directory
			
def check_file(filepath):
	if not os.path.isfile(filepath):
		print 'Error: ' + filepath + ' is not a valid file.'
		sys.exit(1)